import React from 'react';
import { HashRouter, Route, Switch,Redirect} from 'react-router-dom'
import App from './App';
import Login from './pages/login'
import Home from './pages/home'
import Button from './pages/ui/buttons.js'
import Modals from './pages/ui/modals.js'
import Loading from './pages/ui/loading.js'
import Notification from './pages/ui/notification.js'
import Message from './pages/ui/messages.js'
import Tab from './pages/ui/tabs.js'
import Gallery from './pages/ui/gallery.js'
import Carousel from './pages/ui/carousel.js'
import FormLogin from './pages/form/login.js'
import FormRegister from './pages/form/register.js'
import BasicTable from './pages/table/basicTable.js'
import HighTable from './pages/table/highTable.js'
import City from './pages/city'
import Order from './pages/order'
import User from './pages/user'
import Bar from './pages/charts/bar'
import Pie from './pages/charts/pie'
import Line from './pages/charts/line'
import Permission from './pages/permission'
import Admin from './admin'
import NoMatch from './pages/nomatch'
import Common from "./common";
import OrderDetail from './pages/order/detail'
export default class IRouter extends React.Component{
    render() {
        return (
            <HashRouter>
                <App>
                    <Switch>
                        <Route path="/login" component={Login}/>
                        <Route path="/common" render={() =>
                            <Common>
                                <Route path="/common/order/detail/:orderId" component={OrderDetail}/>
                            </Common>
                        } />
                        <Route path="/" render={() =>
                            <Admin>
                                <Switch>
                                    <Route  path="/home" component={Home}/>
                                    <Route  path="/ui/buttons" component={Button}/>
                                    <Route  path="/ui/modals" component={Modals}/>
                                    <Route  path="/ui/loadings" component={Loading}/>
                                    <Route  path="/ui/notification" component={Notification}/>
                                    <Route  path="/ui/messages" component={Message}/>
                                    <Route  path="/ui/tabs" component={Tab}/>
                                    <Route  path="/ui/gallery" component={Gallery}/>
                                    <Route  path="/ui/carousel" component={Carousel}/>
                                    <Route  path="/form/login" component={FormLogin}/>
                                    <Route  path="/form/reg" component={FormRegister}/>
                                    <Route  path="/table/basic" component={BasicTable}/>
                                    <Route  path="/table/high" component={HighTable}/>
                                    <Route  path="/city" component={City}/>
                                    <Route  path="/order" component={Order}/>
                                    <Route  path="/user" component={User}/>
                                    <Route  path="/charts/bar" component={Bar}/>
                                    <Route  path="/charts/pie" component={Pie}/>
                                    <Route  path="/charts/line" component={Line}/>
                                    <Route  path="/permission" component={Permission}/>
                                    <Route  component={NoMatch}/>
                                    <Redirect to="/home" />
                                </Switch>
                            </Admin>
                        }/>
                    </Switch>
                </App>
            </HashRouter>
        )
    }
}
